<div class="main-content">
    <h1><a name="API Mediation Policies"></a>API Mediation Policies</h1>

            <hr/>
            <h4 class="operation-heading"><a name="apisApiIdMediationPoliciesGet"></a>Get all mediation policies of an API
</h4> <code>GET https://apis.wso2.com/api/am/publisher/v1/apis/{apiId}/mediation-policies</code>
            <p class="marked"></p>

            <p class="marked">This operation provides you a list of available mediation policies of an API.
</p>

            <h4 class="section-heading">OAuth 2.0 Scope</h4>
                <code>apim:api_view</code>
                <code>apim:mediation_policy_view</code>

            <h4 class="section-heading">
                Examples
            </h4>
            <h4 class="section-heading">
                <u>get mediation policies of an api</u>
            </h4>
                <div class="pointer" data-toggle="collapse" data-target="#request-apisApiIdMediationPoliciesGet">
                    <h5 class="section-heading">
                        Request
                            <span class="glyphicon glyphicon-collapse-down" aria-hidden="true"></span>
                    </h5>
                </div>
                    <div id="request-apisApiIdMediationPoliciesGet"class="pre collapse in"><code class="json">GET https://localhost:9443/api/am/publisher/v1/apis/a8f0fb89-edf9-484c-b937-036b088f287d/mediation-policies HTTP 1/1
Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
</code></div>

                <div class="pointer" data-toggle="collapse" data-target="#response-apisApiIdMediationPoliciesGet">
                    <h5 class="section-heading">
                        Response
                            <span class="glyphicon glyphicon-collapse-down" aria-hidden="true"></span>
                    </h5>
                </div>
                    <div id="response-apisApiIdMediationPoliciesGet" class="pre collapse in"><code class="json">HTTP 1/1 200 OK
Content-Type: application/json

{
  &quot;id&quot; : &quot;24cea00d-9f4a-48d5-89b0-cbf01d487782&quot;,
  &quot;name&quot; : &quot;header_sequence1&quot;,
  &quot;type&quot; : &quot;IN&quot;,
  &quot;sourceType&quot; : &quot;FILE&quot;
}</code></div>

                <h5 class="section-heading">CURL</h5>
                    <div class="pre"><code class="bash">curl -k -v -X GET &#39;https://localhost:9443/api/am/publisher/v1/apis/a8f0fb89-edf9-484c-b937-036b088f287d/mediation-policies&#39; -H &#39;Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8&#39; </code></div>


            <h4 class="section-heading" id="scroll-to">Parameters</h4>
            <table class="table table-hover">
                <colgroup>
                    <col style="width: 10%;"/>
                    <col style="width: 20%;"/>
                    <col style="width: 40%;"/>
                    <col style="width: 10%;"/>
                    <col style="width: 20%;"/>
                </colgroup>
                <thead>
                <tr class="active">
                    <th>Type</th>
                    <th>Name</th>
                    <th>Description</th>
                    <th>Schema</th>
                    <th>Default</th>
                </tr>
                </thead>
                    <tr>
                        <td class="parameter">
                            
                            
                            <span class="param-in">Path </span>
                            
                            
                        </td>
                        <td class="param-name">
                            <p>apiId</p>
                            <p class="param-required">
                                required
                                
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">**API ID** consisting of the **UUID** of the API.
</p>
                        </td>
                        <td>
                            <span class="param-type">
                                String
                            </span>
                        </td>
                        <td>
                            <p class="marked"></p>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter">
                            
                            <span class="param-in">Query </span>
                            
                            
                            
                        </td>
                        <td class="param-name">
                            <p>limit</p>
                            <p class="param-required">
                                
                                optional
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">Maximum size of resource array to return.
</p>
                        </td>
                        <td>
                            <span class="param-type">
                                Integer
                            </span>
                        </td>
                        <td>
                            <p class="marked">25</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter">
                            
                            <span class="param-in">Query </span>
                            
                            
                            
                        </td>
                        <td class="param-name">
                            <p>offset</p>
                            <p class="param-required">
                                
                                optional
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">Starting point within the complete list of items qualified.
</p>
                        </td>
                        <td>
                            <span class="param-type">
                                Integer
                            </span>
                        </td>
                        <td>
                            <p class="marked">0</p>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter">
                            
                            <span class="param-in">Query </span>
                            
                            
                            
                        </td>
                        <td class="param-name">
                            <p>query</p>
                            <p class="param-required">
                                
                                optional
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">-Not supported yet-</p>
                        </td>
                        <td>
                            <span class="param-type">
                                String
                            </span>
                        </td>
                        <td>
                            <p class="marked"></p>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter">
                            
                            
                            
                            <span class="param-in">Header </span>
                            
                        </td>
                        <td class="param-name">
                            <p>If-None-Match</p>
                            <p class="param-required">
                                
                                optional
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">Validator for conditional requests; based on the ETag of the formerly retrieved
variant of the resource.
</p>
                        </td>
                        <td>
                            <span class="param-type">
                                String
                            </span>
                        </td>
                        <td>
                            <p class="marked"></p>
                        </td>
                    </tr>
            </table>

            <h4 class="section-heading">Responses</h4>

            <table class="table table-hover">
                <colgroup>
                    <col style="width: 15%;"/>
                    <col style="width: 70%;"/>
                    <col style="width: 15%;"/>
                </colgroup>
                <thead>
                <tr class="active">
                    <th>HTTP Code</th>
                    <th>Description</th>
                    <th>Schema</th>
                </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="parameter"><p class="marked">200</p></td>
                        <td class="parameter"><p class="marked">OK. List of qualifying APIs is returned. </p></td>
                        <td class="parameter">
                            <span class="parameter">
                                    <a href="#!/models#MediationList">MediationList</a>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter"><p class="marked">304</p></td>
                        <td class="parameter"><p class="marked">Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future). </p></td>
                        <td class="parameter">
                            <span class="parameter">
                                    
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter"><p class="marked">406</p></td>
                        <td class="parameter"><p class="marked">Not Acceptable. The requested media type is not supported </p></td>
                        <td class="parameter">
                            <span class="parameter">
                                    <a href="#!/models#Error">Error</a>
                            </span>
                        </td>
                    </tr>
                </tbody>
            </table>
            <hr/>
            <h4 class="operation-heading"><a name="apisApiIdMediationPoliciesPost"></a>Add an API specific mediation policy</h4> <code>POST https://apis.wso2.com/api/am/publisher/v1/apis/{apiId}/mediation-policies</code>
            <p class="marked"></p>

            <p class="marked">This operation can be used to add an API specifc mediation policy.
</p>

            <h4 class="section-heading">OAuth 2.0 Scope</h4>
                <code>apim:api_create</code>
                <code>apim:mediation_policy_create</code>

            <h4 class="section-heading">
                Examples
            </h4>
            <h4 class="section-heading">
                <u>Using a IN sequence as a file</u>
            </h4>
                <div class="pointer" data-toggle="collapse" data-target="#request-apisApiIdMediationPoliciesPost">
                    <h5 class="section-heading">
                        Request
                            <span class="glyphicon glyphicon-collapse-down" aria-hidden="true"></span>
                    </h5>
                </div>
                    <div id="request-apisApiIdMediationPoliciesPost"class="pre collapse in"><code class="json">POST https://localhost:9443/api/am/publisher/v1/apis/a8f0fb89-edf9-484c-b937-036b088f287d/mediation-policies HTTP 1/1
Authorization: Bearer eff01a97-4dc0-3542-a184-75aecf355ec2
Content-Type: multipart/form-data; boundary&#x3D;------------------------3da639a2c2734c24
Content-Length: 457
</code></div>

                <div class="pointer" data-toggle="collapse" data-target="#response-apisApiIdMediationPoliciesPost">
                    <h5 class="section-heading">
                        Response
                            <span class="glyphicon glyphicon-collapse-down" aria-hidden="true"></span>
                    </h5>
                </div>
                    <div id="response-apisApiIdMediationPoliciesPost" class="pre collapse in"><code class="json">HTTP 1/1 201 Created
Content-Type: application/json
Location: https://localhost:9443/api/am/publisher/v1/registry/resource/_system/governance/apimgt/applicationdata/provider/admin/testwb/1.0/in/sampleSeq2.xml

{
  &quot;id&quot; : &quot;d6487f8d-5f46-44ff-bb5a-cacf82f7b1ee&quot;,
  &quot;name&quot; : &quot;header_sequence2&quot;,
  &quot;type&quot; : &quot;IN&quot;,
  &quot;sourceType&quot; : &quot;FILE&quot;
}</code></div>

                <h5 class="section-heading">CURL</h5>
                    <div class="pre"><code class="bash">curl -X POST https://localhost:9443/api/am/publisher/v1/apis/2a3d5469-5394-4576-974a-5f8bf7e400bd/mediation-policies  -H &quot;Authorization: Bearer 5cbc7d4f-d4f1-33c9-87e4-68a22ae7e602&quot; -F file&#x3D;@sampleSeq2.xml -H &quot;Content-Type: multipart/form-data&quot; -F &quot;type&#x3D;in&quot;
</code></div>


            <h4 class="section-heading" id="scroll-to">Parameters</h4>
            <table class="table table-hover">
                <colgroup>
                    <col style="width: 10%;"/>
                    <col style="width: 20%;"/>
                    <col style="width: 40%;"/>
                    <col style="width: 10%;"/>
                    <col style="width: 20%;"/>
                </colgroup>
                <thead>
                <tr class="active">
                    <th>Type</th>
                    <th>Name</th>
                    <th>Description</th>
                    <th>Schema</th>
                    <th>Default</th>
                </tr>
                </thead>
                    <tr>
                        <td class="parameter">
                            <span class="param-in">Form </span>
                            
                            
                            
                            
                        </td>
                        <td class="param-name">
                            <p>type</p>
                            <p class="param-required">
                                required
                                
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">Type of the mediation sequence</p>
                        </td>
                        <td>
                            <span class="param-type">
                                String
                            </span>
                        </td>
                        <td>
                            <p class="marked"></p>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter">
                            
                            
                            <span class="param-in">Path </span>
                            
                            
                        </td>
                        <td class="param-name">
                            <p>apiId</p>
                            <p class="param-required">
                                required
                                
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">**API ID** consisting of the **UUID** of the API.
</p>
                        </td>
                        <td>
                            <span class="param-type">
                                String
                            </span>
                        </td>
                        <td>
                            <p class="marked"></p>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter">
                            <span class="param-in">Form </span>
                            
                            
                            
                            
                        </td>
                        <td class="param-name">
                            <p>mediationPolicyFile</p>
                            <p class="param-required">
                                
                                optional
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">Mediation Policy to upload</p>
                        </td>
                        <td>
                            <span class="param-type">
                                File
                            </span>
                        </td>
                        <td>
                            <p class="marked"></p>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter">
                            <span class="param-in">Form </span>
                            
                            
                            
                            
                        </td>
                        <td class="param-name">
                            <p>inlineContent</p>
                            <p class="param-required">
                                
                                optional
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">Inline content of the Mediation Policy</p>
                        </td>
                        <td>
                            <span class="param-type">
                                String
                            </span>
                        </td>
                        <td>
                            <p class="marked"></p>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter">
                            
                            
                            
                            <span class="param-in">Header </span>
                            
                        </td>
                        <td class="param-name">
                            <p>If-Match</p>
                            <p class="param-required">
                                
                                optional
                            </p>
                        </td>
                        <td>
                            <p class="param-description marked">Validator for conditional requests; based on ETag.
</p>
                        </td>
                        <td>
                            <span class="param-type">
                                String
                            </span>
                        </td>
                        <td>
                            <p class="marked"></p>
                        </td>
                    </tr>
            </table>

            <h4 class="section-heading">Responses</h4>

            <table class="table table-hover">
                <colgroup>
                    <col style="width: 15%;"/>
                    <col style="width: 70%;"/>
                    <col style="width: 15%;"/>
                </colgroup>
                <thead>
                <tr class="active">
                    <th>HTTP Code</th>
                    <th>Description</th>
                    <th>Schema</th>
                </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="parameter"><p class="marked">201</p></td>
                        <td class="parameter"><p class="marked">OK. mediation policy uploaded </p></td>
                        <td class="parameter">
                            <span class="parameter">
                                    <a href="#!/models#Mediation">Mediation</a>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter"><p class="marked">400</p></td>
                        <td class="parameter"><p class="marked">Bad Request. Invalid request or validation error. </p></td>
                        <td class="parameter">
                            <span class="parameter">
                                    <a href="#!/models#Error">Error</a>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter"><p class="marked">404</p></td>
                        <td class="parameter"><p class="marked">Not Found. The resource to be updated does not exist. </p></td>
                        <td class="parameter">
                            <span class="parameter">
                                    <a href="#!/models#Error">Error</a>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td class="parameter"><p class="marked">412</p></td>
                        <td class="parameter"><p class="marked">Precondition Failed. The request has not been performed because one of the preconditions is not met. </p></td>
                        <td class="parameter">
                            <span class="parameter">
                                    <a href="#!/models#Error">Error</a>
                            </span>
                        </td>
                    </tr>
                </tbody>
            </table>
</div>
